package com.xuetang9.t9.hotel.controller;

import com.xuetang9.t9.hotel.beans.EConsumption;
import com.xuetang9.t9.hotel.beans.OrderFood;
import com.xuetang9.t9.hotel.services.IEConsumptionService;
import com.xuetang9.t9.hotel.services.IOrderFoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/orderfood")
@ResponseBody
public class OrderFoodController {
    @Autowired
    private IOrderFoodService orderFoodService;

    @Autowired
    private IEConsumptionService ieConsumptionService;


    /**
     * 更新数量，并返回新的就餐信息
     * @param orderFood
     * @param id
     * @return
     */
    @RequestMapping(value = "/update/{id}",method = RequestMethod.POST)
    public EConsumption update(@RequestBody OrderFood orderFood, @PathVariable("id") Integer id){
        orderFoodService.update(orderFood);
        return ieConsumptionService.selectByTableId(id);
    }
}
